package week10;

import java.util.Scanner;

public class Main1 {
	public static void main(String[] args) 
	{
		Scanner in = new Scanner(System.in);
		int[] a = new int[5];
		while(true) {
			String choice = in.next();
			switch (choice) {
			case "arr":
				int b = Integer.parseInt(in.next());
				try {
					int c = a[b];	
				}
				catch(ArrayIndexOutOfBoundsException e){
					System.out.println(e);
				}
				break;
			case "null":
				try {
					a[1]=(Integer) null;	
				}
				catch(NullPointerException e){
					System.out.println(e);
				}
				break;
			case "cast":
				try {
					 Object x = "a";
				     System.out.println((Integer)x);
				}
				catch(ClassCastException e){
					System.out.println(e);
				}
				break;
			case "num":
				try {
					String d = in.next();
					Integer e = Integer.parseInt(d);
				}
				catch(NumberFormatException e){
					System.out.println(e);
				}
				break;
			default:
				System.exit(0);
				break;
			}
		}
	}
}
